package com.example.controller;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.client.discovery.DiscoveryClient;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author fuyangrong
 * @date 2020/8/4
 * @description
 */
@RestController
public class HelloController {

	private final Logger logger = LoggerFactory.getLogger(HelloController.class);

	@Autowired
	private DiscoveryClient client;

	@RequestMapping(value= "/hello", method= RequestMethod.GET)
	public String index() {
		List<String> services = client.getServices();
		logger.info(client.description());
		return "hello world";
	}
}
